package login;

import java.util.Random;
import java.util.Scanner;

/**
 * 2024/5/14 String 开发验证码  14：05
 */
public class Code {
    public static void main(String[] args) {

        System.out.println(code(6));
    }

    public static String code(Integer number ) {

        String code = "";
        String data = "abcdefghijklmnopqrstuVWXyZABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
        Random r = new Random();
        for (int i = 0; i < number; i++) {
            int index= r.nextInt(data.length());
             code+=data.charAt(index);
        }
        return code;
    }
}

